<?php
session_start();
include('../includes/index.php');
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
	$sql = "SELECT titel, nieuws_id FROM `nieuws` WHERE `nieuws_id` = " . $_POST['nieuws'] . ";";
	$query = mysql_query ($sql);
	$output = mysql_fetch_assoc ($query);
	$sql2 = "DELETE FROM `nieuws` WHERE `nieuws_id` = " . $nieuws . ";";
	mysql_query($sql2);
	echo 'Het nieuws-item ' . $output['titel'] . ' is met succes verwijderd.';
}
else
{
?>
	<div style="margin-left: 40px;"><form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
	Welk nieuws-item:<br />
	<?php
	$query = mysql_query ("SELECT nieuws_id, titel FROM nieuws");
	echo '<select name="nieuws">';
	while ($result = mysql_fetch_assoc ($query))
	{
		echo '<option value="' . $result['nieuws_id'] . '">' . $result['titel'] . '</option>' . "\n";
	}
	echo '</select>';
	?>
	<br /><br />
	<input type="submit" value="Verwijder nieuws-item">&nbsp;&nbsp;<input type="reset" value="Leeg formulier"></form></div>
<?php
}
//print_r ($_SESSION);
?>